package magicloan.auctionpocket.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.utils.module.StringUtils;
import magicloan.auctionpocket.R;
import magicloan.auctionpocket.ui.activity.AssestActivity;
import magicloan.auctionpocket.ui.activity.LoginActivity;
import magicloan.auctionpocket.ui.activity.MyShowOrderActivity;
import magicloan.auctionpocket.ui.activity.PersonActivity;
import magicloan.auctionpocket.ui.activity.RechargeActivity;
import magicloan.auctionpocket.ui.activity.SettingActivity;
import magicloan.auctionpocket.ui.activity.SuggestActivity;
import magicloan.auctionpocket.ui.activity.myauction.MyAddressActivity;
import magicloan.auctionpocket.ui.activity.myauction.MyAuctionActivity;
import magicloan.auctionpocket.ui.base.BaseFragment;

/**
 * Created by hechao on 2018/1/31.
 */
public class FifthFragment extends BaseFragment {

    @Override
    protected int setFgContentView() {
        return R.layout.fg_fifth;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void beforeInitView() {

    }

    @Override
    protected void afterInitView() {

        mContentView.findViewById(R.id.img_setting).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_person).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_myasset).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_mycoin).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_mygive).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_recharge).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_myauction).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_acution_ing).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_mygetauction).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_auction_unget).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_wait_show).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_auction_show).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_address).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_guide).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_help).setOnClickListener(this);
        mContentView.findViewById(R.id.ll_suggest).setOnClickListener(this);

    }

    @Override
    protected void initData() {

    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        Intent intent = null;
        Bundle bundle = null;

        if ( StringUtils.isEmpty(instance.getToken()) ){
            intent = new Intent(mActivity, LoginActivity.class) ;
        }else{
            switch (v.getId()) {
                case R.id.img_setting:
                    intent = new Intent(mActivity, SettingActivity.class);
                    break;
                case R.id.ll_person:
                    intent = new Intent(mActivity, PersonActivity.class);
                    break;
                case R.id.ll_myasset:
                    intent = new Intent(mActivity, AssestActivity.class);
                    break;
                case R.id.ll_mycoin:
                    intent = new Intent(mActivity, AssestActivity.class);
                    break;
                case R.id.ll_mygive:
                    intent = new Intent(mActivity, AssestActivity.class);
                    break;
                case R.id.ll_recharge:
                    intent = new Intent(mActivity, RechargeActivity.class);
                    break;
                case R.id.ll_myauction:
                    bundle = new Bundle() ;
                    bundle.putInt("page",0);
                    intent = new Intent(mActivity, MyAuctionActivity.class);
                    break;
                case R.id.ll_acution_ing:
                    bundle = new Bundle() ;
                    bundle.putInt("page",1);
                    intent = new Intent(mActivity, MyAuctionActivity.class);
                    break;
                case R.id.ll_mygetauction:
                    bundle = new Bundle() ;
                    bundle.putInt("page",2);
                    intent = new Intent(mActivity, MyAuctionActivity.class);
                    break;
                case R.id.ll_auction_unget:
                    bundle = new Bundle() ;
                    bundle.putInt("page",3);
                    intent = new Intent(mActivity, MyAuctionActivity.class);
                    break;
                case R.id.ll_wait_show:
                    bundle = new Bundle() ;
                    bundle.putInt("page",4);
                    intent = new Intent(mActivity, MyAuctionActivity.class);
                    break;
                case R.id.ll_auction_show:
                    intent = new Intent(mActivity, MyShowOrderActivity.class);
                    break;
                case R.id.ll_address:
                    intent = new Intent(mActivity, MyAddressActivity.class);
                    break;
                case R.id.ll_guide:
                    break;
                case R.id.ll_help:
                    break;
                case R.id.ll_suggest:
                    intent = new Intent(mActivity, SuggestActivity.class);
                    break;
            }
            if (bundle != null) {
                intent.putExtras(bundle);
            }
        }

        if ( intent != null )
            startActivity(intent);

    }

}
